package com.shangbang.verb.controller.comm;

import com.shangbang.verb.core.BaseResponse;
import com.shangbang.verb.util.StsServiceUtil;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

@Api(value = "公用工具", tags = "公用工具", description = "")

@RestController
@RequestMapping(value = "/comm")
public class CommController {


    /**
     * 获取ossToken
     * @param request
     * @param response
     * @return
     */
    @ApiOperation(value = "获取图片token",notes = "获取图片token")
    @ApiResponses({ @ApiResponse(code = 0, message = "操作成功"),
            @ApiResponse(code = -1, message = "操作失败") })

    @RequestMapping(value = "/getToken", method = {RequestMethod.POST, RequestMethod.GET})
    public BaseResponse getToken(HttpServletRequest request, HttpServletResponse response
                                             ) {

        Map<String,Object> map = new HashMap<String,Object>();
            map.put("ossKey",StsServiceUtil.getOssToken());
            Integer code = 0;
            String msg = "成功";
            return new BaseResponse(code, msg, map);
    }



}
